package com.lql.modules.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.lql.common.entity.User;
import com.lql.modules.service.IUserService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Title:
 * @Description:
 * @Author: longge
 * @Date: 2020/8/21
 * @Version: V1.0
 */
@Log4j2
@Service
public class UserServiceImpl implements IUserService {

    @Override
    public boolean saveUser(User user) {
        return user.insert();
    }

    @Override
    public User getById(Integer userId) {
        return new User().selectById(userId);
    }

    @Override
    public List<User> getByOpenId(String openId, Integer merCode) {
        return new User().selectList(new LambdaQueryWrapper<User>()
                .eq(User::getOpenId, openId)
                .eq(User::getMerchantCode, merCode));
    }

}
